$(function () {
    $.ajax({
        url: "sideBar",
        async: false,
        timeout: 3000,
        dataType: "json",
        success: function (data) {
            parseBar(data);
        },
        error: function () {
            alert("获取菜单失败!");
        }
    });
});
function parseBar(data) {
    if (data) {
        if (data.code == 100) {
            var html = "", td, cd;
            data = data.message;
            for (var i = 0; i < data.length; i++) {
                td = data[i];
                html += "<li>";
                html += "<a href=\"" + td.menuurl + "\"><i class=\"fa " + td.menuclass + " nav_icon\"></i>" + td.name;
                cd = td.children;
                if (cd && cd.length > 0) {
                    html += "<span class=\"fa arrow\"></span></a>";
                    html += "<ul class=\"nav nav-second-level\">";
                    for (var j = 0; j < cd.length; j++) {
                        td = cd[j];
                        html += "<li>";
                        html += "<a href=\"" + td.menuurl + "\">" + td.name + "</a>";
                        html += "</li>";
                    }
                    html += "</ul>";
                }
                html += "</li>";
            }
            $("#side-menu").append(html);
        } else {
            alert(data.message);
        }
    } else {
        alert("获取菜单失败!");
    }
}
function getBasePath() {

}
